package com.example.ovulationperiodtracker.periodadepter;

import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CursorAdapter;
import android.widget.ListAdapter;
import android.widget.TextView;

import com.example.ovulationperiodtracker.utils.JCGSQLiteHelper;
import com.example.ovulationperiodtracker.R;

import java.util.ArrayList;
import java.util.List;

public class NotificationAdapter extends BaseAdapter {
    private Context context;
    private List<String> itemList;

    public NotificationAdapter(Context context) {
        this.context = context;
        itemList = new ArrayList<>();
        itemList.add("经期提醒");
        itemList.add("易孕期期提醒");
        itemList.add("排卵提醒");
    }

    @Override
    public int getCount() {
        return itemList.size();
    }

    @Override
    public Object getItem(int position) {
        return itemList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;

        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(R.layout.item_list_notification, parent, false);
            holder = new ViewHolder();
            holder.title = convertView.findViewById(R.id.txtNotificationname);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        String currentItem = itemList.get(position);
        holder.title.setText(currentItem);

        return convertView;
    }

    static class ViewHolder {
        TextView title;
    }
}
